// -----------------------------------------------------------------------
//  <copyright file="IResource.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2025 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2025/1/5 22:32</last-date>
// -----------------------------------------------------------------------

using DaprPlus.Domain.Entity;


namespace DaprPlus.Authorization;

/// <summary>
/// 定义权限判断的资源信息
/// </summary>
public interface IResource : ILockable, ICreationTime
{
    /// <summary>
    /// 获取 资源标识符
    /// </summary>
    long Id { get; }

    /// <summary>
    /// 获取 资源名称
    /// </summary>
    string Name { get; }

    /// <summary>
    /// 获取 资源代码，资源唯一性的确定标识
    /// </summary>
    string Code { get; }

    /// <summary>
    /// 获取 资源描述
    /// </summary>
    string? Description { get; }

    /// <summary>
    /// 获取 所属服务名称
    /// </summary>
    string ServiceName { get; }

    /// <summary>
    /// 获取 资源类型
    /// </summary>
    ResourceType Type { get; }

    /// <summary>
    /// 获取或设置 资源访问类型
    /// </summary>
    ResourceAccessType AccessType { get; set; }

    /// <summary>
    /// 获取 访问类型是否已更改，如true，刷新资源时将忽略访问类型的变更
    /// </summary>
    bool IsAccessTypeChanged { get; }

    /// <summary>
    /// 获取 是否系统资源，由系统初始化收集的资源信息
    /// </summary>
    bool IsSystem { get; }

    /// <summary>
    /// 获取 元数据，用于存储各个特色资源的数据
    /// </summary>
    IDictionary<string, object> GetMetadata();

    /// <summary>
    /// 获取 允许的操作列表
    /// </summary>
    ResourceOperation[] GetAllowedOperations();
}
